package com.sff.site.tree {
	
	import com.sff.core.IDisposable;
	import com.sff.core.sff_internal;
	import com.sff.site.abstract.AbstractTree;
	import com.sff.site.core.INode;
	import com.sff.site.node.NodeDescriptor;
	import com.sff.site.node.Node;
	
	import flash.net.URLVariables;	
	

	public class Tree extends AbstractTree implements IDisposable {

		public function Tree( rootNode : Node ) {
			super( rootNode );
		}

		override public function activate(params : URLVariables = null) : void {
			root.activate(params);
		}

		public function dispose() : void {
			root.sff_internal::dispose();
			_rootNode = null;
		}
		
		override protected function newNode( subDesc : NodeDescriptor, parent : INode ) : INode {
			use namespace sff_internal;
			var p : Node = parent as Node;
			var ref : TreeNode = p.getReferer().getChild( subDesc.id ) as TreeNode;
			var n : Node = ref.createNode( p );
			n.describe( subDesc );
			return n;
		}		
	}
}
